# Copyright (c) 2025 pony working team
# SPDX-License-Identifier: MulanPSL-2.0

GNU_PREFIX := arm-none-eabi-

ifdef CONFIG_CORTEX_M0
cflags-arch += -mcpu=cortex-m0
else ifdef CONFIG_CORTEX_M0_PLUS
cflags-arch += -mcpu=cortex-m0plus
else ifdef CONFIG_CORTEX_M3
cflags-arch += -mcpu=cortex-m3
else ifdef CONFIG_CORTEX_M4
cflags-arch += -mcpu=cortex-m4
fpu-version := -mfpu=fpv4-sp-d16
else ifdef CONFIG_CORTEX_M7
cflags-arch += -mcpu=cortex-m7
fpu-version := -mfpu=fpv5-sp-d16
else ifdef CONFIG_CORTEX_M33
cflags-arch += -mcpu=cortex-m33
fpu-version := -mfpu=fpv5-sp-d16
else ifdef CONFIG_CORTEX_M55
cflags-arch += -mcpu=cortex-m55
fpu-version := -mfpu=auto
endif

ifdef CONFIG_FPU
cflags-arch += -mfloat-abi=hard $(fpu-version)
else
cflags-arch += -mfloat-abi=soft
endif

cflags-arch += -mthumb -mabi=aapcs

include $(root_dir)/scripts/make/arch/ld.mk
